//
//  UILabel+YWK.m
//  YWKUser
//
//  Created by  WangDan on 16/4/28.
//  Copyright © 2016年 iCareTech. All rights reserved.
//

#import "UILabel+YWK.h"

@implementation UILabel (YWK)

- (CGSize)txtSize{
    
    NSTextAlignment alignment = self.textAlignment;
    
    self.textAlignment = NSTextAlignmentLeft;
    self.lineBreakMode = NSLineBreakByWordWrapping;
    
    
    CGSize size = [self.text  boundingRectWithSize:CGSizeMake(MAXFLOAT, 50)
                                           options:NSStringDrawingTruncatesLastVisibleLine
                                                | NSStringDrawingUsesLineFragmentOrigin
                                                | NSStringDrawingUsesFontLeading
                                        attributes:@{NSFontAttributeName:self.font}
                                           context:nil].size;
    
    self.textAlignment = alignment;
    
    return size;
}

@end
